//
//  WorkContentTableViewCell.m
//  LubanWork
//
//  Created by xiaotong on 2020/1/2.
//  Copyright © 2020 xiaohao. All rights reserved.
//

#import "WorkContentTableViewCell.h"

@implementation WorkContentTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)layoutSubviews{
    [super layoutSubviews];
    NSLog(@"%f",self.height);
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        self.backgroundColor = ColorWhite;
        [self.contentView addSubview:self.WorkContentLab];
        [self.contentView addSubview:self.WorkJoinTypeLab];
//        [self.contentView addSubview:self.WorkConten];
        [self.contentView addSubview:self.TimeImage];
        [self.contentView addSubview:self.TeamImag];
        [self.contentView addSubview:self.mapImage];
        [self.contentView addSubview:self.Timelab];
        [self.contentView addSubview:self.TeamNumberLab];
        [self.contentView addSubview:self.mapLab];
        
        UILabel *title1 = [UILabel CreatLabeltext:@"[工作内容]" Font:kFONT(15) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
        
        UILabel *title2 = [UILabel CreatLabeltext:@"[报名方式]" Font:kFONT(15) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
        
//        UILabel *title3 = [UILabel CreatLabeltext:@"[工作内容]" Font:kFONT(15) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:title1];
        [self.contentView addSubview:title2];
//        [self.contentView addSubview:title3];
        [title1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.contentView).offset(kSCRATIO(20));
            make.left.equalTo(self.contentView).offset(kSCRATIO(35));
            make.right.equalTo(self.contentView).offset(-kSCRATIO(35));
//            make.height.mas_offset(kSCRATIO(15));
        }];
        
        [self.WorkContentLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(title1.mas_bottom).offset(kSCRATIO(19.5));
            make.left.equalTo(self.contentView).offset(kSCRATIO(25));
            make.right.equalTo(self.contentView.mas_right).offset(-kSCRATIO(25));
//            make.height.mas_offset(kSCRATIO(12));
        }]; 
        
        [title2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.WorkContentLab.mas_bottom).offset(kSCRATIO(20));
            make.left.equalTo(self.contentView).offset(kSCRATIO(35));
            make.right.equalTo(self.contentView).offset(-kSCRATIO(35));
//            make.height.mas_offset(kSCRATIO(15));
        }];
        
        [self.WorkJoinTypeLab mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(title2.mas_bottom).offset(kSCRATIO(19.5));
           make.left.equalTo(self.contentView).offset(kSCRATIO(25));
           make.right.equalTo(self.contentView.mas_right).offset(-kSCRATIO(25));
//           make.height.mas_offset(kSCRATIO(12));
        }];
        
//        [title3 mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.WorkJoinTypeLab.mas_bottom).offset(kSCRATIO(20));
//            make.left.equalTo(self.contentView).offset(kSCRATIO(35));
//            make.right.equalTo(self.contentView).offset(-kSCRATIO(35));
//            make.height.mas_offset(kSCRATIO(15));
//        }];
        
        
//        [self.WorkConten mas_makeConstraints:^(MASConst
        [self.TeamImag mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.WorkJoinTypeLab.mas_bottom).offset(kSCRATIO(20));
            make.left.equalTo(self.contentView).offset(kSCRATIO(25));
            make.width.height.mas_offset(kSCRATIO(20));
        }];
        
        [self.TeamNumberLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.TeamImag.mas_centerY);
            make.left.equalTo(self.TeamImag.mas_right).offset(kSCRATIO(5));
//            make.height.mas_offset(kSCRATIO(12));
            make.right.equalTo(self.contentView.mas_right).offset(-kSCRATIO(48));
        }];
        
        [self.TimeImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.TeamImag.mas_bottom).offset(kSCRATIO(20));
            make.left.equalTo(self.contentView).offset(kSCRATIO(25));
            make.width.height.mas_offset(kSCRATIO(20));
        }];
        
        [self.Timelab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.TimeImage.mas_centerY);
            make.left.equalTo(self.TimeImage.mas_right).offset(kSCRATIO(5));
//            make.height.mas_offset(kSCRATIO(12));
            make.right.equalTo(self.contentView.mas_right).offset(-kSCRATIO(48));
        }];
        
        [self.mapImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.TimeImage.mas_bottom).offset(kSCRATIO(20));
            make.left.equalTo(self.contentView).offset(kSCRATIO(25));
            make.width.height.mas_offset(kSCRATIO(20));
        }];
        
        [self.mapLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mapImage.mas_centerY);
            make.left.equalTo(self.mapImage.mas_right).offset(kSCRATIO(5));
//            make.height.mas_offset(kSCRATIO(12));
            make.right.equalTo(self.contentView.mas_right).offset(-kSCRATIO(48));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kSCRATIO(25));
        }];
        
    }
//    NSLog(@"%f",self.frame.size.height);
    
    
    return self;
}



-(UILabel *)WorkContentLab{
    if (!_WorkContentLab) {
        _WorkContentLab = [UILabel CreatLabeltext:@"日结 | 长期 | 男女不限 " Font:kFONT(12) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
        _WorkContentLab.numberOfLines = 0;
    }
    return _WorkContentLab;
}


-(UILabel *)WorkJoinTypeLab{
    if (!_WorkJoinTypeLab) {
        _WorkJoinTypeLab = [UILabel CreatLabeltext:@"日结 | 长期 | 男女不限 " Font:kFONT(12) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
    }
    return _WorkJoinTypeLab;
}

//-(UILabel *)WorkConten{
//    if (!_WorkConten) {
//        _WorkConten = [UILabel CreatLabeltext:@"日结 | 长期 | 男女不限 " Font:kFONT(12) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
//    }
//    return _WorkConten;
//}


-(UIImageView *)TeamImag{
    if (!_TeamImag) {
        _TeamImag = [[UIImageView alloc] init];
        _TeamImag.image = [UIImage imageNamed:@"team"];
    }
    return _TeamImag;
}

-(UIImageView *)TimeImage{
    if (!_TimeImage) {
        _TimeImage = [[UIImageView alloc] init];
        _TimeImage.image = [UIImage imageNamed:@"time"];
    }
    return _TimeImage;
}

-(UIImageView *)mapImage{
    if (!_mapImage) {
        _mapImage = [[UIImageView alloc] init];
        _mapImage.image = [UIImage imageNamed:@"map"];
    }
    return _mapImage;
}

-(UILabel *)TeamNumberLab{
    if (!_TeamNumberLab) {
        _TeamNumberLab = [UILabel CreatLabeltext:@"400人" Font:kFONT(12) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
    }
    return _TeamNumberLab;
}

-(UILabel *)Timelab{
    if (!_Timelab) {
        _Timelab = [UILabel CreatLabeltext:@"不限时间" Font:kFONT(12) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
    }
    return _Timelab;
}

-(UILabel *)mapLab{
    if (!_mapLab) {
        _mapLab = [UILabel CreatLabeltext:@"不限地点" Font:kFONT(12) Textcolor:kColorFromRGBHex(0x666666) textAlignment:NSTextAlignmentLeft];
    }
    return _mapLab;
}

@end
